home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-10-14 | 1.9 KB | 82 lines |
- package com.symantec.itools.tools.archive;
-
-
- import java.io.File;
- import java.io.IOException;
- import com.symantec.itools.io.FileSystem;
- import com.symantec.itools.lang.Debug;
- import com.symantec.itools.lang.ProcessManager;
-
-
- /**
- * @author Symantec Internet Tools Division
- * @version 1.0
- * @since VCafe 3.0
- */
-
- public class CABArchiver
- extends TypeArchiver
- {
- /**
- * @since VCafe 3.0
- */
- protected ProcessManager processManager;
-
- public CABArchiver(Options options)
- {
- super(options);
- }
-
- /**
- * @param errorMsg TODO
- * @since VCafe 3.0
- */
- public boolean create(StringBuffer errorMsg)
- {
- DirectoryArchiver archiver;
- String outFile;
- StringBuffer command;
-
- outFile = options.getOutputLocation();
- options.setOutputLocation(options.getTempDir());
- archiver = new DirectoryArchiver(options);
-
- if(!(archiver.create(errorMsg)))
- {
- return (false);
- }
-
- options.setOutputLocation(outFile);
- command = new StringBuffer(FileSystem.quoteIfNeeded(FileSystem.getCanonicalPath(options.getMicrosoftTools(), true) + "cabarc.exe"));
- command.append(' ').append(options.getArchiverArgs());
-
- try
- {
- processManager = new ProcessManager();
-
- if(processManager.monitorLaunchedProcess(Runtime.getRuntime().exec(command.toString())) != 0)
- {
- return (false);
- }
- }
- catch(IOException ex)
- {
- Debug.logException(ex);
- return (false);
- }
-
- return (true);
- }
-
- /**
- * @since VCafe 3.0
- */
- public void cancel()
- {
- if(processManager != null)
- {
- processManager.destroyProcess();
- processManager = null;
- }
- }
- }